Safe Instantiation in Generic Java
ثبت نشده
چکیده
This paper presents the “safe-instantiation principle” a new design principle for evaluating extensions of Java with support for generic types. We discuss the GJ and NextGen formulations of Generic Java and the implications of safe instantiation on both approaches. We then consider the implications of safe-instantiation for the addition of mixins to Java via generic types. Finally, we defend the formulation of mixins as hygienic program constructs, arguing that a hygienic formulation is the only way to maintain safe instantiation and type soundness in Java with mixins, and to prevent the introduction of insidious bugs with no clearly defined point of blame.
منابع مشابه
Safe instantiation in generic Java
This paper presents the “Safe-Instantiation Principle,” a new design principle for evaluating extensions of Java with support for generic types. We discuss the GJ and NextGen formulations of Generic Java and the implications of safe instantiation on both approaches. We then consider the implications of safe-instantiation for the addition of mixins to Java via generic types. Finally, we defend t...
متن کاملJava Wildcards Meet Definition-Site Variance
Variance is concerned with the interplay of parametric polymorphism (i.e., templates, generics) and subtyping. The study of variance gives answers to the question of when an instantiation of a generic class can be a subtype of another. In this work, we combine the mechanisms of use-site variance (as in Java) and definition-site variance (as in Scala and C#) in a single type system, based on Jav...
متن کاملRefactoring Techniques for Migrating Applications to Generic Java Container Classes
Version 1.5 of the Java programming language will include generics, a language construct for associating typeparameterswith classes and methods. Generics are particularly useful for creating statically type-safe, reusable container classes such that a store of an inappropriate type causes a compile-time error, and that no down-casting is needed when retrieving elements. The standard libraries r...
متن کاملEfficient Implementation of Run-time Generic Types for Java
We describe an efficient compiler and run-time system for NextGen, a compatible extension of the Java programming language supporting run-time generic types designed by Cartwright and Steele. The resulting system is comparable in performance with both standard Java and the GJ extension of Java, which does not support run-time generic types. Our implementation of NextGen consists of a compiler e...
متن کاملReverse Generics - Parametrization after the Fact
By abstracting over types, generic programming enables one to write code that is independent from specific data type implementation. This style is supported by most mainstream languages, including C++ with templates and Java with generics. If some code is not designed in a generic way from the start, a major effort is required to convert this code to use generic types. This conversion is manual...
متن کامل